package person.wend.springbootlearnexample.controller;

import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/users")
public class MyRestController {

    @GetMapping("/{userId}")
    public void getUser(@PathVariable Long userId) {
        System.out.println("userId = " + userId);
    }

    @GetMapping("/{userId}/customers")
    public void getUserCustomers(@PathVariable Long userId) {
        System.out.println("userId = " + userId);
    }

    @DeleteMapping("/{userId}")
    public void deleteUser(@PathVariable Long userId) {
        System.out.println("userId = " + userId);
    }

    @GetMapping("/throwRunTimeException")
    public void throwRunTimeExceptionTest() {
        System.out.println("throwRunTimeExceptionTest");
        throw new RuntimeException("throwRunTimeExceptionTest");
    }

}